package org.styx.seata.tcc.storage.tcc;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @date 2021/10/8
 * @auther uranus
 */
@LocalTCC
public interface StorageTccAction {
    /**
     *
     * @param context
     * @param productId
     * @param count
     * @return
     */
    @TwoPhaseBusinessAction(name="storageTccAction")
    boolean prepareDecreaseStorage(BusinessActionContext context,
                                   @BusinessActionContextParameter(paramName =
                                           "productId") Long productId,
                                   @BusinessActionContextParameter(paramName =
                                           "count") Integer count);

    boolean commit(BusinessActionContext context);
    boolean rollback(BusinessActionContext context);
}
